/*
 * @Descripttion:
 * @Author: voanit
 * @Date: 2022-09-01 09:23:15
 * @LastEditors: voanit
 * @LastEditTime: 2022-09-06 14:29:01
 */
import {
  createRouter,
  createWebHashHistory,
  createWebHistory,
} from 'vue-router'

// 1. 创建路由
const router = createRouter({
  // 创建history模式的路由
  history: createWebHistory(),
  // 创建hash模式的路由
  // history: createWebHashHistory(),
  // 配置路由规则
  routes: [
    {
      path: '/', component: () => import('../views/layout/index.vue'), children: [
        {
          path: '',
          component: () => import('../views/home/index.vue')
        },
        {
          path: 'category/:id',
          component: () => import('../views/category/index.vue')
        },
        {
          path: 'category/sub/:id',
          component: () => import('../views/category/sub.vue')
        }
      ]
    },
    { path: '/login', component: () => import('../views/login/index.vue') }
  ],
})

export default router
